package com.Sql;

import java.io.Reader;
import java.nio.charset.Charset;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class MySqlConfig
{
  private static final SqlMapClient sqlMap;

  public static SqlMapClient getSqlMapInstance()
  {
    return sqlMap;
  }

  static
  {
    try
    {
    	
      Charset charset = Charset.forName("UTF-8");
      Resources.setCharset(charset);

      String resource = "mySqlMap-Config.xml";
      Reader configReader = Resources.getResourceAsReader(resource);
      sqlMap = SqlMapClientBuilder.buildSqlMapClient(configReader);
      configReader.close();
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException("초기화 오류 MySqlConfig class. 오류 : " + e);
    }
  }
}

